package com.huawei.service;

public class RockPaperScissorlmpl implements RockPaperScissor {
    /**
     * @param person
     * @param computer
     * @Description: 石头剪刀布的游戏规则
     * 对应的输赢平，0-输，1-赢，2-平
     */

    @Override
    public int gameStandardOfPerson(int person, int computer) {
        //0-石头，1-剪刀，2-布
        int result = 0;
        switch (person) {
            case 0:
                if (computer == 0) {
                    result = 2;
                    System.out.println("平局");
                } else if (computer == 1) {
                    result = 1;
                    System.out.println("玩家获胜");
                } else if (computer == 2) {
                    result = 0;
                    System.out.println("电脑获胜");
                } else {
                    System.out.println("请输入正确字符");
                }
                break;
            case 1:
                if (computer == 0) {
                    result = 0;
                    System.out.println("电脑获胜");
                } else if (computer == 1) {
                    result = 2;
                    System.out.println("平局");
                } else if (computer == 2) {
                    result = 1;
                    System.out.println("玩家获胜");
                } else {
                    System.out.println("请输入正确字符");
                }

            case 2:
                if (computer == 0) {
                    result = 1;
                    System.out.println("玩家获胜");
                } else if (computer == 1) {
                    result = 0;
                    System.out.println("电脑获胜");
                } else if (computer == 2) {
                    result = 2;
                    System.out.println("平局");
                } else {
                    System.out.println("请输入正确字符");
                }
        }

    return 0;
    }

}